<?php
/**
 * Created by PhpStorm.
 * User: serenehaly
 * Date: 2018/2/6
 * Time: 9:48
 */

namespace app\api\model;


class Category extends BaseModel
{
    protected $hidden = ['delete_time', 'update_time', 'description'];

    public function img() {
        return $this->belongsTo('Image', 'topic_img_id', 'id');
    }

    public static function getAllCategory() {
        $category = self::with('img')->select();
        return $category;
    }
}